import { init } from 'snabbdom/init'
import { classModule } from 'snabbdom/modules/class'
import { propsModule } from 'snabbdom/modules/props'
import { styleModule } from 'snabbdom/modules/style'
import { eventListenersModule } from 'snabbdom/modules/eventlisteners'
import { h } from 'snabbdom/h'

const patch = init([classModule,propsModule,styleModule,eventListenersModule])

const vnode1 = h('ul',{},[
    h('li',{},'a'),
    h('li',{},'b'),
    h('li',{},'c'),
    h('li',{},'d')
])

const container = document.getElementById('container')
const btn = document.getElementById('btn')
patch(container,vnode1)

const vnode2 = h('ul',{},[
    h('li',{},'a'),
    h('li',{},'b'),
    h('li',{},'c'),
    h('li',{},'d'),
    h('li',{},'e'),
])

btn.onclick = function(){
    patch(vnode1, vnode2)
}